using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public enum PropType
{
    Wide = 0,
    Short = 1,
    Fast = 2,
    Slow = 3,
    Add_AttackPower = 4,
}

public class Prop : MonoBehaviour
{
    [SerializeField] private Vector3 dir;
    [SerializeField] private float moveSpeed;
    [SerializeField] private float duration;
    [SerializeField] private PropType type;
    
    private Locomotion locomotion;

    private void Awake() {
        locomotion = GetComponent<Locomotion>();
    }

    private void FixedUpdate() {
        locomotion.SetVelocity(dir * moveSpeed);
    }

    private void OnTriggerEnter2D(Collider2D other) {
        if(other.gameObject.TryGetComponent<Paddle>(out var paddle))
        {
            EventHandler.Dispatch(Events.GetBuff, type, duration);
            
            gameObject.SetActive(false);
        }
    }
}
